﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admins/Administrator.Master" AutoEventWireup="true"
    CodeFile="User.aspx.cs" Inherits="FacebookApp.Admins_User" %>

<%@ MasterType VirtualPath="~/Admins/Administrator.Master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="title">
        User Manager</div>
    <asp:Panel ID="pnShow" runat="server" Width="100%">
        <table id="Table1" style="border-collapse: collapse; background-color: #EBEEF4;"
            cellpadding="0" width="100%" border="0">
            <tr>
                <td class="name_fild_row">
                    Group User:&nbsp;<asp:DropDownList ID="dllGroupUser_Id" runat="server" Width="200px">
                    </asp:DropDownList>
                    <asp:Button ID="btnshow" runat="server" Text="Display" OnClick="btnshow_Click" class="fb_invite_button">
                    </asp:Button>
                </td>
            </tr>
            <tr>
                <td>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Button ID="btnThem" runat="server" Text="Add" OnClick="btnThem_Click" class="fb_invite_button" />
                    <asp:Button ID="btnXoa" runat="server" Text="Delete" OnClick="btnXoa_Click" class="fb_invite_button" />
                </td>
            </tr>
        </table>
        <asp:DataGrid ID="grdUser" runat="server" AllowPaging="True" AutoGenerateColumns="False"
            CellPadding="4" ForeColor="#333333" Width="100%" OnPageIndexChanged="grdUser_PageIndexChanged"
            PageSize="10" OnItemCommand="grdUser_ItemCommand" OnItemDataBound="grdUser_ItemDataBound">
            <AlternatingItemStyle BackColor="White" />
            <HeaderStyle CssClass="trHeader"></HeaderStyle>
            <Columns>
                <asp:TemplateColumn ItemStyle-CssClass="tdCenter">
                    <HeaderTemplate>
                        <asp:CheckBox ID="chkSelectAll" runat="server" AutoPostBack="False"></asp:CheckBox></HeaderTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="chkSelect" runat="server"></asp:CheckBox></ItemTemplate>
                    <ItemStyle CssClass="tdCenter" HorizontalAlign="Center"></ItemStyle>
                </asp:TemplateColumn>
                <asp:TemplateColumn ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Center">
                    <HeaderTemplate>
                        #</HeaderTemplate>
                    <ItemTemplate>
                        <%# grdUser.CurrentPageIndex * grdUser.PageSize + grdUser.Items.Count + 1%>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" Width="50px" />
                </asp:TemplateColumn>
                <asp:BoundColumn DataField="ID" HeaderText="ID" Visible="False"></asp:BoundColumn>
                <asp:BoundColumn DataField="FB_Id" HeaderText="FB_Id" Visible="False"></asp:BoundColumn>
                <asp:BoundColumn DataField="UserName" HeaderText="UserName"></asp:BoundColumn>
                <asp:BoundColumn DataField="FullName" HeaderText="FullName"></asp:BoundColumn>
                <asp:BoundColumn DataField="Address" HeaderText="Address"></asp:BoundColumn>
                <asp:BoundColumn DataField="Password" HeaderText="Password" Visible="False"></asp:BoundColumn>
                <asp:BoundColumn DataField="Phone" HeaderText="Phone"></asp:BoundColumn>
                <asp:BoundColumn DataField="Email" HeaderText="Email"></asp:BoundColumn>
                <asp:BoundColumn DataField="Status" HeaderText="Status"></asp:BoundColumn>
                <asp:BoundColumn DataField="DateLogin" HeaderText="DateLogin"></asp:BoundColumn>
                <%--<asp:BoundColumn DataField="GroupUser_Id" HeaderText="GroupUser_Id"></asp:BoundColumn>--%>
                <asp:TemplateColumn ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Center">
                    <HeaderTemplate>
                        Function</HeaderTemplate>
                    <ItemTemplate>
                        <asp:LinkButton ID="lbt1" runat="server" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"ID")%>'
                            CommandName="Edit" CssClass="edit" ToolTip="Edit">&nbsp;</asp:LinkButton>|<asp:LinkButton
                                ID="lbt2" runat="server" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"ID")%>'
                                CommandName="Delete" CssClass="delete" OnClientClick="return confirm('Do you want to delete?')"
                                ToolTip="Delete">&nbsp;</asp:LinkButton></ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" Width="100px" />
                </asp:TemplateColumn>
            </Columns>
            <EditItemStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" HorizontalAlign="Center" />
            <ItemStyle BackColor="#EFF3FB" />
            <PagerStyle BackColor="#F3F8FE" ForeColor="Blue" HorizontalAlign="Center" Mode="NumericPages" />
            <SelectedItemStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        </asp:DataGrid></asp:Panel>
    <asp:Panel ID="pnUpdate" runat="server" Visible="False" Width="100%">
        <table id="Table2" style="border-collapse: collapse" cellpadding="0" width="100%"
            border="0">
            <tr>
                <td width="150" height="10">
                </td>
                <td height="10">
                </td>
            </tr>
            <tr>
                <td style="display: none;">
                    &nbsp;<asp:Label ID="lblID" runat="server">ID</asp:Label>
                </td>
                <td style="display: none;">
                    <asp:TextBox ID="txtID" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td width="150" class="name_fild_row">
                    &nbsp;<asp:Label ID="lblFB_Id" runat="server">FB_Id</asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtFB_Id" runat="server" Width="200px"></asp:TextBox>
                    <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator2" ControlToValidate="txtFB_Id"
                        Display="Dynamic" ErrorMessage="Facebook ID not format" ValidationExpression="(^([0-9]*|\d*\d{1}?\d*)$)"
                        ForeColor="Red">
                    </asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td width="150" class="name_fild_row">
                    &nbsp;<asp:Label ID="lblUserName" runat="server">UserName</asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtUserName" runat="server" Width="200px"></asp:TextBox>
                    <asp:RegularExpressionValidator runat="server" ID="revUserName" ControlToValidate="txtUserName"
                        Display="Dynamic" ErrorMessage="Min 3 and max 12 letters!" ValidationExpression="^([a-z0-9_\.\s]{3,12})$"
                        ForeColor="Red">
                    </asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td width="150" class="name_fild_row">
                    &nbsp;<asp:Label ID="lblPassword" runat="server">Password</asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtPassword" runat="server" Width="200px" TextMode="Password"></asp:TextBox>
                    <asp:RegularExpressionValidator runat="server" ID="revPassword" ControlToValidate="txtPassword"
                        Display="Dynamic" ErrorMessage="Password not null/ min 3 letters" ValidationExpression="^([A-Za-z0-9_\s\$\#@\!\*]{3,150})$"
                        ForeColor="Red">
                    </asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td width="150" class="name_fild_row">
                    &nbsp;<asp:Label ID="lblFullName" runat="server">FullName</asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtFullName" runat="server" Width="200px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td width="150" class="name_fild_row">
                    &nbsp;<asp:Label ID="lblAddress" runat="server">Address</asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtAddress" runat="server" Width="200px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td width="150" class="name_fild_row">
                    &nbsp;<asp:Label ID="lblPhone" runat="server">Phone</asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtPhone" runat="server" Width="200px"></asp:TextBox>
                    <asp:RegularExpressionValidator runat="server" ID="valNumbersOnly" ControlToValidate="txtPhone"
                        Display="Dynamic" ErrorMessage="PhoneNumber not format" ValidationExpression="(^([0-9]*|\d*\d{1}?\d*)$)"
                        ForeColor="Red">
                    </asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td width="150" class="name_fild_row">
                    &nbsp;<asp:Label ID="lblEmail" runat="server">Email</asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtEmail" runat="server" Width="200px"></asp:TextBox>
                    <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator1" ControlToValidate="txtEmail"
                        Display="Dynamic" ErrorMessage="Email not format!username@domain" ValidationExpression="(^([a-z][a-z0-9_\.]{2,32}@[a-z0-9\-]{1,}(\.[a-z]{2,4}){1,})$)"
                        ForeColor="Red">
                    </asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td width="150" class="name_fild_row">
                    &nbsp;<asp:Label ID="lblStatus" runat="server">Status</asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="ddlStatus" runat="server" Width="200px">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td width="150" class="name_fild_row">
                    &nbsp;<asp:Label ID="lblGroupUser_Id" runat="server">GroupUser_Id</asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="dllGroupUser_Id_Update" runat="server" Width="200px">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td width="150">
                    &nbsp;
                </td>
                <td>
                    &nbsp;<asp:LinkButton ID="lbtUpdate" CssClass="update" runat="server" OnClick="lblUpdate_Click">Update</asp:LinkButton>&nbsp;&nbsp;<asp:LinkButton
                        ID="lblBack" runat="server" CssClass="back" OnClick="lblBack_Click">Back</asp:LinkButton>
                </td>
            </tr>
        </table>
    </asp:Panel>
</asp:Content>
